const diy = {
	state: {
		pageValue: {
			name: '自定义页面',
			auther: 'xxx',
			create_time: '2021-03-11',
			lists: [{
				controller: 'Header',
				attribute: {
					text: '测试标题',
					bgcolor: 'bg-gradual-blue',
					back: false
				},
				url: '',
				data: []
			}]
		},
		elementCurrent: 0,
		elementAttribute: null
	},
	mutations: {
		onLoadDiyState(state, data) {
			if (uni.getStorageSync('elementCurrent')) {
				state.elementCurrent = uni.getStorageSync('elementCurrent');
			}
		},
		setPageValue(state, data) {
			state.pageValue = data;
		},
		addPageElement(state, data) {
			state.pageValue.lists.push(data);
		},
		delPageElement(state,index) {
			state.pageValue.lists.splice(index, 1);
		},
		setPageElementList(state, data) {
			state.pageValue.lists = data;
		},
		setElementCurrent(state, data) {
			state.elementCurrent = data;
			uni.setStorageSync('elementCurrent', data);
		},
		updateElementAtrr(state, data) {
			state.elementAttribute = data;
		},
		updateElementList(state, data) {
			state.pageValue.lists[state.elementCurrent].attribute = state.elementAttribute;
		},
		updateElementData(state, data) {
			state.pageValue.lists[state.elementCurrent].data = data;
		}
	},
	actions: {

	},
	getters: {}
};
export default diy;
